home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 4 / QRZ Ham Radio Callsign Database - Volume 4.iso / files / dsp / 56ktools / dspkgctr.z / dspkgctr / gcc / config / tm-dsp16.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-08  |  35.5 KB  |  1,020 lines

  1. /* Definitions of target machine for GNU compiler, for the Motorola dsp561XX
  2.    digital signal processing chip.
  3.    Copyright (C) 1988 Free Software Foundation, Inc.
  4.  
  5.    $Header: /usr1/dsp/cvsroot/source/gcc/config/tm-dsp16.h,v 1.2 91/09/18 15:34:46 jeff Exp $
  6.    $Id: tm-dsp16.h,v 1.2 91/09/18 15:34:46 jeff Exp $
  7.  
  8. This file is part of GNU CC.
  9.  
  10. GNU CC is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY.  No author or distributor
  12. accepts responsibility to anyone for the consequences of using it
  13. or for whether it serves any particular purpose or works at all,
  14. unless he says so in writing.  Refer to the GNU CC General Public
  15. License for full details.
  16.  
  17. Everyone is granted permission to copy, modify and redistribute
  18. GNU CC, but only under the conditions described in the
  19. GNU CC General Public License.   A copy of this license is
  20. supposed to have been given to you along with GNU CC so you
  21. can know your rights and responsibilities.  It should be in a
  22. file named COPYING.  Among other things, the copyright notice
  23. and this notice must be preserved on all copies.  */
  24.  
  25.  
  26. /* Note that some other tm- files include this one and then override
  27.    many of the definitions that relate to assembler syntax.  */
  28.  
  29. #define DSP56100 1
  30.  
  31. /* Turn on debugging output */
  32.  
  33. #define SDB_DEBUGGING_INFO
  34.  
  35. /* Names to predefine in the preprocessor for this target machine.  */
  36.  
  37. #define CPP_PREDEFINES "-DDSP16"
  38.  
  39. /* Print subsidiary information on the compiler version in use.  */
  40. #define TARGET_VERSION fprintf (stderr, " Motorola DSP561XX %s", \
  41.                 motorola_version_string);
  42.  
  43. /* Run-time compilation parameters selecting different hardware subsets. */
  44.  
  45. extern int target_flags;
  46.  
  47. /* Macro to define tables used to set the flags.
  48.    This is a list in braces of pairs in braces,
  49.    each pair being { "NAME", VALUE }
  50.    where VALUE is the bits to set or minus the bits to clear.
  51.    An empty string NAME is used to identify the default VALUE.  */
  52.  
  53. #define DSP_ALL_OPTS                483
  54. #define TARGET_DSP                ( target_flags & DSP_ALL_OPTS )
  55. #define TARGET_LINV_PLUS_BIV_PROMOTION        ( target_flags & 1 )
  56. #define TARGET_DO_LOOP_GENERATION        ( target_flags & 2 )
  57. #define TARGET_X_MEMORY                 ( target_flags & 4 )
  58. #define TARGET_Y_MEMORY                ( target_flags & 8 )
  59. #define TARGET_L_MEMORY                ( target_flags & 16 )
  60. #define TARGET_CALL_OVERHEAD_REDUCTION        ( target_flags & 32 )
  61. #define TARGET_REP                ( target_flags & 64 )
  62. #define TARGET_RELOAD_CLEANUP            ( target_flags & 128 )
  63. #define TARGET_NORMALIZATION_REDUCTION          ( target_flags & 256 )
  64. #define TARGET_STACK_CHECK            ( target_flags & 4096 )
  65. #define TARGET_SWITCHES        \
  66.   {{ "dsp", DSP_ALL_OPTS },                       \
  67.    { "no-dsp", -DSP_ALL_OPTS },                 \
  68.    { "linv-plus-biv-promotion", 1 },        \
  69.    { "no-linv-plus-biv-promotion", -1 },    \
  70.    { "do-loop-generation", 2 },            \
  71.    { "no-do-loop-generation", -2 },        \
  72.    { "x-memory", 4 },                \
  73.    { "y-memory", 8 },                \
  74.    { "l-memory", 16 },                \
  75.    { "call-overhead-reduction", 32 },           \
  76.    { "no-call-overhead-reduction", -32 },       \
  77.    { "rep", 64 },                \
  78.    { "no-rep", -64 },                \
  79.    { "reload-cleanup", 128 },            \
  80.    { "no-reload-cleanup", -128 },        \
  81.    { "normalization-reduction", 256 },          \
  82.    { "no-normalization-reduction", -256 },      \
  83.    { "stack-check", 4096 },                     \
  84.    { "no-stack-check", 4096 },                  \
  85.    { "", TARGET_DEFAULT}}
  86.  
  87. #define TARGET_DEFAULT ( 8 + DSP_ALL_OPTS )
  88.  
  89. /* target machine storage layout */
  90.  
  91. /* Define this if most significant bit is lowest numbered
  92.    in instructions that operate on numbered bit-fields.  */
  93. /* m96k is numbered 31..0 */
  94. #undef BITS_BIG_ENDIAN
  95.  
  96. /* Define this if most significant byte of a word is the lowest numbered.  */
  97. /* has no byte address but if it did they would look like 3..2..1..0 */
  98. #undef BYTES_BIG_ENDIAN
  99.  
  100. /* Define this if most significant word of a multiword object has the lowest
  101.    is number. */
  102. #undef WORDS_BIG_ENDIAN 
  103.  
  104. /* number of bits in an addressible storage unit. has word addressing */
  105. #define BITS_PER_UNIT 16
  106. #define CHAR_TYPE_SIZE 16
  107. #define SHORT_TYPE_SIZE 16
  108. #define LONG_TYPE_SIZE 32
  109. #define LONG_LONG_TYPE_SIZE LONG_TYPE_SIZE
  110. #define FLOAT_TYPE_SIZE (( 'l' == memory_model ) ? 16 : 32 )
  111. #define DOUBLE_TYPE_SIZE FLOAT_TYPE_SIZE
  112. #define LONG_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
  113.  
  114. /* the maximum nesting depth of do-loops allowed. */
  115. #define MAX_DO_LOOP_NESTING 3
  116.  
  117. /* Width in bits of a "word", which is the contents of a machine register.
  118.    Note that this is not necessarily the width of data type `int';
  119.    if using 16-bit ints on a 68000, this would still be 32.
  120.    But on a machine with 16-bit registers, this would be 16.  */
  121. #define BITS_PER_WORD 16
  122.  
  123. /* Width of a word, in units (bytes).  */
  124. #define UNITS_PER_WORD 1
  125.  
  126. /* Width in bits of a pointer.
  127.    See also the macro `Pmode' defined below.  */
  128. #define POINTER_SIZE 16
  129.  
  130. /* Allocation boundary (in *bits*) for storing pointers in memory.  */
  131. #define POINTER_BOUNDARY 16
  132.  
  133. /* Allocation boundary (in *bits*) for storing arguments in argument list.  */
  134. #define PARM_BOUNDARY 16
  135.  
  136. /* Allocation boundary (in *bits*) for the code of a function.  */
  137. #define FUNCTION_BOUNDARY 16
  138.  
  139. /* Alignment of field after `int : 0' in a structure.  */
  140. #define EMPTY_FIELD_BOUNDARY 16
  141.  
  142. /* No data type wants to be aligned rounder than this.  */
  143. #define BIGGEST_ALIGNMENT 16
  144.  
  145. /* Define this if move instructions will actually fail to work
  146.    when given unaligned data.  */
  147. #define STRICT_ALIGNMENT
  148.  
  149. /* Standard register usage.  */
  150.  
  151. /*
  152.   Number of actual hardware registers.
  153.   The hardware registers are assigned numbers for the compiler
  154.   from 0 to just below FIRST_PSEUDO_REGISTER.
  155.   All registers that the compiler knows about must be given numbers,
  156.   even those that are not normally considered general registers.
  157.  
  158.   for the dsp16, we have X1,X0,Y1,Y0,A,B and R0-R3. N0-N3 remain unknown
  159.   to the compiler so that the addressing mode of Rx+const so loved
  160.   by gcc can be fixed up into Rx+Nx.
  161. */
  162. #define FIRST_PSEUDO_REGISTER 10
  163.  
  164. /* 1 for registers that have pervasive standard uses
  165.    and are not available for the register allocator.
  166.  
  167.    for the dsp16:
  168.  
  169.    0..5    = (a, b, x0, x1, y0, y1)
  170.    6       = (r0) frame pointer.
  171.    7,8     = (r1, r2)
  172.    9       = (r3) stack pointer.
  173. */
  174. #define DSP16_A_REGNUM 0
  175. #define DSP16_B_REGNUM 1
  176. #define DSP16_X0_REGNUM 2
  177. #define DSP16_X1_REGNUM 3
  178. #define DSP16_Y0_REGNUM 4
  179. #define DSP16_Y1_REGNUM 5
  180.  
  181. #define FIXED_REGISTERS   \
  182.  {0, 0, 0, 0, 0, 0,       \
  183.   1, 0, 0, 1}
  184.  
  185. /* Like FIXED_REGISTERS but has a 1 for each register that is clobbered
  186.    ( in general ) by function calls. This macro therefore identifies the
  187.    registers that are not available for general allocation of values that
  188.    live across function calls.
  189.    If a register has 0 in CALL_USED_REGISTERS the compiler automatically
  190.    saves it on function entry if the register is used within that function.
  191.  
  192.    These must include the FIXED_REGISTERS and also any
  193.    registers that can be used without being saved.
  194.    The latter must include the registers where values are returned
  195.    and the register where structure-value addresses are passed.
  196.    Aside from that, you can include as many other registers as you like.  */
  197. #define CALL_USED_REGISTERS  \
  198.  {1, 0, 0, 0, 0, 0,          \
  199.   1, 0, 0, 1}
  200.  
  201. /* Return number of consecutive hard regs needed starting at reg REGNO
  202.    to hold something of mode MODE.
  203.    This is ordinarily the length in words of a value of mode MODE
  204.    but can be less for certain modes in special long registers.
  205.  
  206.    dsp16 puts floats/doubles into 32 bit regs, longs into 32 bit regs. */
  207.  
  208. #define HARD_REGNO_NREGS( REGNO, MODE ) \
  209.     ((( DFmode == MODE || SFmode == MODE || DImode == MODE ) && \
  210.       ( REGNO != DSP16_A_REGNUM ) && ( REGNO != DSP16_B_REGNUM )) ? 2 : 1 )
  211.   
  212. /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
  213.  
  214. #define HARD_REGNO_MODE_OK( REGNO, MODE )        \
  215.     hard_regno_mode_ok( REGNO, MODE )
  216.  
  217. /* Value is 1 if it is a good idea to tie two pseudo registers
  218.    when one has mode MODE1 and one has mode MODE2.
  219.    If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
  220.    for any hard reg, then this must be 0 for correct output.  */
  221.  
  222. #define MODES_TIEABLE_P(MODE1, MODE2) \
  223.     modes_tieable_p( MODE1, MODE2 )
  224.  
  225. /* Specify the registers used for certain standard purposes.
  226.    The values of these macros are register numbers.  */
  227.  
  228. #undef PC_REGNUM
  229.  
  230. /* Register to use for pushing function arguments.  */
  231. #define STACK_POINTER_REGNUM 9
  232.  
  233. /* Base register for access to local variables of the function.  */
  234. #define FRAME_POINTER_REGNUM 6
  235.  
  236. /* Value should be nonzero if functions must have frame pointers.
  237.    Zero means the frame pointer need not be set up (and parms
  238.    may be accessed via the stack pointer) in functions that seem suitable.
  239.    This is computed in `reload', in reload1.c.  */
  240. #define FRAME_POINTER_REQUIRED 1
  241.  
  242. /* Base register for access to arguments of the function.  */
  243. #define ARG_POINTER_REGNUM FRAME_POINTER_REGNUM
  244.  
  245. /* Register in which static-chain is passed to a function.  */
  246. /* This is currently not used but this may change for pascal or ada or ... */
  247. #define STATIC_CHAIN_REGNUM DSP16_A_REGNUM
  248.  
  249. /* Register in which address to store a structure value
  250.    is passed to a function.  */
  251. #define STRUCT_VALUE_REGNUM DSP16_A_REGNUM
  252.  
  253.  
  254. /* Define the classes of registers for register constraints in the
  255.    machine description.  Also define ranges of constants.
  256.  
  257.    One of the classes must always be named ALL_REGS and include all hard regs.
  258.    If there is more than one class, another class must be named NO_REGS
  259.    and contain no registers.
  260.  
  261.    The name GENERAL_REGS must be the name of a class (or an alias for
  262.    another name such as ALL_REGS).  This is the class of registers
  263.    that is allowed by "g" or "r" in a register constraint.
  264.    Also, registers outside this class are allocated only when
  265.    instructions express preferences for them.
  266.  
  267.    The classes must be numbered in nondecreasing order; that is,
  268.    a larger-numbered class must never be contained completely
  269.    in a smaller-numbered class.
  270.  
  271.    For any two classes, it is very desirable that there be another
  272.    class that represents their union.  */
  273.    
  274. enum reg_class
  275. {
  276.     NO_REGS,
  277.     DST_REGS,     /* All-mode destination registers: a, b */
  278.     ADDR_REGS,    /* PSImode registers: r0-r7 */
  279.     MPY_REGS,      /* source regs valid for mpy/mac multiplier x0,y0. */
  280.     SRC_REGS,     /* All-mode source registers: x1, x0, y1, y0 */
  281.     ALL_REGS,
  282.     LIM_REG_CLASSES
  283. };
  284.  
  285. #define N_REG_CLASSES (int) LIM_REG_CLASSES
  286.  
  287. /* Since GENERAL_REGS is the same class as NO_REGS,
  288.    don't give it a different class number; just make it an alias.  */
  289.  
  290. #define GENERAL_REGS NO_REGS
  291.  
  292. /* Give names of register classes as strings for dump file.   */
  293.  
  294. #define REG_CLASS_NAMES { \
  295.     "NO_REGS", "DST_REGS", "ADDR_REGS",\
  296.         "MPY_REGS","SRC_REGS", "ALL_REGS" }
  297.  
  298. /* Define which registers fit in which classes.
  299.    This is an initializer for a vector of HARD_REG_SET
  300.    of length N_REG_CLASSES.  */
  301.  
  302. #define REG_CLASS_CONTENTS {            \
  303.     000000000000, /* NO_REGS */        \
  304.     000000000003, /* DST_REGS */        \
  305.     000000001700, /* ADDR_REGS */        \
  306.     000000000024, /* MPY_REGS */        \
  307.     000000000074, /* SRC_REGS */        \
  308.     000000001777  /* ALL_REGS */    }
  309.  
  310. /* The same information, inverted:
  311.    Return the class number of the smallest class containing
  312.    reg number REGNO.  This could be a conditional expression
  313.    or could index an array.  */
  314.  
  315. #define REGNO_REG_CLASS(REGNO)                    \
  316.     regno_reg_class ( REGNO )
  317.  
  318. #define IS_SRC_OR_MPY_P(REGNO)                    \
  319.     ( SRC_REGS == REGNO_REG_CLASS( REGNO ) ||        \
  320.       MPY_REGS == REGNO_REG_CLASS( REGNO ))
  321.  
  322. /* The class value for index registers, and the one for base regs.  */
  323. #define INDEX_REG_CLASS ADDR_REGS
  324. #define BASE_REG_CLASS ADDR_REGS
  325.  
  326. /* Get reg_class from a letter such as appears in the machine description.  */
  327.  
  328. #define REG_CLASS_FROM_LETTER(C)                \
  329.     reg_class_from_letter( C )
  330.  
  331. /* The letters I, J, K, L and M in a register constraint string
  332.    can be used to stand for particular ranges of immediate operands.
  333.    This macro defines what the ranges are.
  334.    C is the letter, and VALUE is a constant value.
  335.    Return 1 if VALUE is in the range specified by C.
  336. */
  337. #define CONST_OK_FOR_LETTER_P(VALUE, C)             \
  338.     ( 'J' != ( C ) || ( ! ( 0xffffff00 & ( VALUE ))))
  339.  
  340. /* Similar, but for floating constants, and defining letters G and H.
  341.    Here VALUE is the CONST_DOUBLE rtx itself.  */
  342.  
  343. #define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) 1
  344.  
  345. /* Given an rtx X being reloaded into a reg required to be
  346.    in class CLASS, return the class of reg to actually use.
  347.    In general this is just CLASS; but on some machines
  348.    in some cases it is preferable to use a more restrictive class.  */
  349. #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
  350.  
  351. /* Return the maximum number of consecutive registers
  352.    needed to represent mode MODE in a register of class CLASS.  */
  353.  
  354. #define CLASS_MAX_NREGS(CLASS,MODE)                    \
  355.     class_max_nregs ( CLASS, MODE )
  356.  
  357. /* Stack layout; function entry, exit and calling.  */
  358.  
  359. #define PUSH_ARGS_REVERSED
  360.  
  361. /* Define this if pushing a word on the stack
  362.    makes the stack pointer a smaller address.  */
  363. #undef STACK_GROWS_DOWNWARD
  364.  
  365. /* Define this if the nominal address of the stack frame
  366.    is at the high-address end of the local variables;
  367.    that is, each additional local variable allocated
  368.    goes at a more negative offset in the frame.
  369.  
  370. #undef FRAME_GROWS_DOWNWARD 
  371.  
  372. /* Offset within stack frame to start allocating local variables at.
  373.    If FRAME_GROWS_DOWNWARD, this is the offset to the END of the
  374.    first local allocated.  Otherwise, it is the offset to the BEGINNING
  375.    of the first local allocated.  */
  376. #define STARTING_FRAME_OFFSET 0
  377.  
  378. /* If we generate an insn to push BYTES bytes,
  379.    this says how many the stack pointer really advances by. */
  380. #define PUSH_ROUNDING(BYTES) ( BYTES )
  381.  
  382. /* If BYTES is the size of arguments for a function call,
  383.    return the size of the argument block (which is BYTES suitably rounded).
  384.    Define this only on machines where the entire call block is allocated
  385.    before the args are stored into it.  */
  386.    
  387. #undef ROUND_CALL_BLOCK_SIZE
  388.  
  389. /* Offset of first parameter from the argument pointer register value.  */
  390. #define FIRST_PARM_OFFSET(FNDECL) \
  391.     local_first_parm_offset ( FNDECL )
  392.  
  393. /* Value is 1 if returning from a function call automatically
  394.    pops the arguments described by the number-of-args field in the call.
  395.    FUNTYPE is the data type of the function (as a tree),
  396.    or for a library call it is an identifier node for the subroutine name.  */
  397.  
  398. #define RETURN_POPS_ARGS(FUNTYPE) 1
  399.  
  400. /* Define how to find the value returned by a function.
  401.    VALTYPE is the data type of the value (as a tree).
  402.    If the precise function being called is known, FUNC is its FUNCTION_DECL;
  403.    otherwise, FUNC is 0.  */
  404. #define LIBCALL_VALUE(MODE)  (gen_rtx ( REG, MODE, DSP16_A_REGNUM ))
  405.  
  406. #define FUNCTION_VALUE(VALTYPE, FUNC)  LIBCALL_VALUE ( TYPE_MODE (VALTYPE) )
  407.  
  408. /* Define how to find the value returned by a library function
  409.    assuming the value has mode MODE.  */
  410.  
  411. /* 1 if N is a possible register number for a function value
  412.    as seen by the caller.*/
  413.  
  414. #define FUNCTION_VALUE_REGNO_P(N) ( DSP16_A_REGNUM == ( N ))
  415.  
  416. /* 1 if N is a possible register number for function argument passing. */
  417.  
  418. #define FUNCTION_ARG_REGNO_P(N) 0
  419.  
  420. /* Define a data type for recording info about an argument list
  421.    during the scan of that argument list.  This data type should
  422.    hold all necessary information about the function itself
  423.    and about the args processed so far, enough to enable macros
  424.    such as FUNCTION_ARG to determine where the next arg should go.
  425. */
  426. #define CUMULATIVE_ARGS int
  427.  
  428. /* Initialize a variable CUM of type CUMULATIVE_ARGS
  429.    for a call to a function whose data type is FNTYPE.
  430.    For a library call, FNTYPE is 0.
  431. */
  432. #define INIT_CUMULATIVE_ARGS(CUM,FNTYPE) ((CUM) = 0)
  433.  
  434. /* Update the data in CUM to advance over an argument
  435.    of mode MODE and data type TYPE.
  436.    (TYPE is null for libcalls where that information may not be available.)  */
  437.  
  438. #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) ((CUM) ++)
  439.  
  440. /* Determine where to put an argument to a function.
  441.    Value is zero to push the argument on the stack,
  442.    or a hard register in which to store the argument.
  443.  
  444.    MODE is the argument's machine mode.
  445.    TYPE is the data type of the argument (as a tree).
  446.     This is null for libcalls where that information may
  447.     not be available.
  448.    CUM is a variable of type CUMULATIVE_ARGS which gives info about
  449.     the preceding args and about the function being called.
  450.    NAMED is nonzero if this argument is a named parameter
  451.     (otherwise it is an extra parameter matching an ellipsis).  */
  452.  
  453. #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) 0
  454.  
  455. /* Define where a function finds its arguments.
  456.    This would be different from FUNCTION_ARG if we had register windows.  */
  457.  
  458. #define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED)    \
  459.     local_function_incoming_arg ( CUM, MODE, TYPE, NAMED )
  460.  
  461. /* For an arg passed partly in registers and partly in memory,
  462.    this is the number of registers used.
  463.    For args passed entirely in registers or entirely in memory, zero.  */
  464.  
  465. #define FUNCTION_ARG_PADDING(A,B) none
  466. #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) 0
  467. #undef FUNCTION_ARG_PARTIAL_NREGS
  468.  
  469. /* This macro generates the assembly code for function entry.
  470.    FILE is a stdio stream to output the code to.
  471.    SIZE is an int: how many units of temporary storage to allocate.
  472.    Refer to the array `regs_ever_live' to determine which registers
  473.    to save; `regs_ever_live[I]' is nonzero if register number I
  474.    is ever used in the function.  This macro is responsible for
  475.    knowing which registers should not be saved even if used.  */
  476.  
  477. #define FUNCTION_PROLOGUE(FILE, SIZE) function_logue ( FILE, SIZE, 0 )
  478.  
  479. /* Output assembler code to FILE to increment profiler label # LABELNO
  480.    for profiling a function entry. */
  481.  
  482. #define FUNCTION_PROFILER(FILE, LABELNO) 
  483.  
  484. /* EXIT_IGNORE_STACK should be nonzero if, when returning from a function,
  485.    the stack pointer does not matter.  The value is tested only in
  486.    functions that have frame pointers.
  487.    No definition is equivalent to always zero.  */
  488.  
  489. #define EXIT_IGNORE_STACK 0
  490.  
  491. /* This macro generates the assembly code for function exit,
  492.    on machines that need it.  If FUNCTION_EPILOGUE is not defined
  493.    then individual return instructions are generated for each
  494.    return statement.  Args are same as for FUNCTION_PROLOGUE.
  495.  
  496.    The function epilogue should not depend on the current stack pointer!
  497.    It should use the frame pointer only.  This is mandatory because
  498.    of alloca; we also take advantage of it to omit stack adjustments
  499.    before returning.  */
  500.  
  501. #define FUNCTION_EPILOGUE(FILE, SIZE) function_logue ( FILE, SIZE, 1 )
  502.  
  503. /* If the memory address ADDR is relative to the frame pointer,
  504.    correct it to be relative to the stack pointer instead.
  505.    This is for when we don't use a frame pointer.
  506.    ADDR should be a variable name.  */
  507.  
  508. #define FIX_FRAME_POINTER_ADDRESS(ADDR,DEPTH)
  509.  
  510. /* Addressing modes, and classification of registers for them.  */
  511.  
  512. #define HAVE_POST_INCREMENT
  513. #define HAVE_POST_DECREMENT
  514.  
  515. #undef HAVE_PRE_DECREMENT
  516. #undef HAVE_PRE_INCREMENT 
  517.  
  518. /* Macros to check register numbers against specific register classes.  */
  519.  
  520. /* These assume that REGNO is a hard or pseudo reg number.
  521.    They give nonzero only if REGNO is a hard reg of the suitable class
  522.    or a pseudo reg currently allocated to a suitable hard reg.
  523.    Since they use reg_renumber, they are safe only once reg_renumber
  524.    has been allocated, which happens in local-alloc.c.  */
  525.  
  526. #define REGNO_OK_FOR_BASE_P(REGNO)                  \
  527.     (( 5 < REGNO && 10 > REGNO ) ||                \
  528.      ( 5 < reg_renumber[REGNO] && 10 > reg_renumber[REGNO]))
  529.  
  530. #define REGNO_OK_FOR_INDEX_P(REGNO)                 \
  531.     (( 5 < REGNO && 10 > REGNO ) ||                \
  532.      ( 5 < reg_renumber[REGNO] && 10 > reg_renumber[REGNO]))
  533.  
  534. /* Now macros that check whether X is a register and also,
  535.    strictly, whether it is in a specified class. */
  536.  
  537. /* Maximum number of registers that can appear in a valid memory address.  */
  538.  
  539. #define MAX_REGS_PER_ADDRESS 1
  540.  
  541. /* Recognize any constant value that is a valid address.  */
  542.  
  543. #define CONSTANT_ADDRESS_P(X)  CONSTANT_P(X)
  544.  
  545. /* Nonzero if the constant value X is a legitimate general operand.
  546.    It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
  547.  
  548. #define LEGITIMATE_CONSTANT_P(X) (CONSTANT_P(X)||CONST_DOUBLE==GET_CODE(X))
  549.  
  550. /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
  551.    and check its validity for a certain class.
  552.    We have two alternate definitions for each of them.
  553.    The usual definition accepts all pseudo regs; the other rejects
  554.    them unless they have been allocated suitable hard regs.
  555.    The symbol REG_OK_STRICT causes the latter definition to be used.
  556.  
  557.    Most source files want to accept pseudo regs in the hope that
  558.    they will get allocated to the class that the insn wants them to be in.
  559.    Source files for reload pass need to be strict.
  560.    After reload, it makes no difference, since pseudo regs have
  561.    been eliminated by then.  */
  562.  
  563. #ifndef REG_OK_STRICT
  564.  
  565. /*
  566.  * Nonzero if X is a hard reg that can be used as an index
  567.  * or if it is a pseudo reg.
  568.  */
  569. #define REG_OK_FOR_INDEX_P(X)                         \
  570.     ( REG_P ( X ) &&                                                    \
  571.      (( REGNO ( X ) >= FIRST_PSEUDO_REGISTER ) ||                       \
  572.       ( REGNO ( X ) > 5 && REGNO ( X ) < 10 )))
  573. /*
  574.  * Nonzero if X is a hard reg that can be used as a base reg
  575.  * or if it is a pseudo reg.
  576.  */
  577. #define REG_OK_FOR_BASE_P(X)                          \
  578.     ( REG_P ( X ) &&                                                    \
  579.      (( REGNO ( X ) >= FIRST_PSEUDO_REGISTER ) ||                       \
  580.       ( REGNO ( X ) > 5 && REGNO ( X ) < 10 )))
  581.  
  582. #else
  583.  
  584. /* Nonzero if X is a hard reg that can be used as an index.  */
  585. #define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
  586.  
  587. /* Nonzero if X is a hard reg that can be used as a base reg.  */
  588. #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
  589.  
  590. #endif
  591.  
  592. /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
  593.    that is a valid memory address for an instruction.
  594.    The MODE argument is the machine mode for the MEM expression
  595.    that wants to use this address.
  596. */
  597.  
  598. #ifdef REG_OK_STRICT
  599. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)         \
  600.     if ( go_if_legitimate_address ( MODE, X, 1 ) ) goto ADDR;
  601. #else
  602. #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)         \
  603.     if ( go_if_legitimate_address ( MODE, X, 0 ) ) goto ADDR;
  604. #endif
  605.  
  606. /* Try machine-dependent ways of modifying an illegitimate address
  607.    to be legitimate.  If we find one, return the new, valid address.
  608.    This macro is used in only one place: `memory_address' in explow.c.
  609.  
  610.    OLDX is the address as it was before break_out_memory_refs was called.
  611.    In some cases it is useful to look at this to decide what needs to be done.
  612.  
  613.    MODE and WIN are passed so that this macro can use
  614.    GO_IF_LEGITIMATE_ADDRESS.
  615.  
  616.    It is always safe for this macro to do nothing.  It exists to recognize
  617.    opportunities to optimize the output.  */
  618.  
  619. #define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN)
  620.  
  621. /* Go to LABEL if ADDR (a legitimate address expression)
  622.    has an effect that depends on the machine mode it is used for. */
  623.  
  624. #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
  625.  
  626.  
  627. /* Specify the machine mode that this machine uses
  628.    for the index in the tablejump instruction.  */
  629. #define CASE_VECTOR_MODE PSImode
  630.  
  631. /* Define this if a raw index is all that is needed for a
  632.    `tablejump' insn.  */
  633. #undef CASE_TAKES_INDEX_RAW
  634.  
  635. /* Define this if the tablejump instruction expects the table
  636.    to contain offsets from the address of the table.
  637.    Do not define this if the table should contain absolute addresses.  */
  638. #undef CASE_VECTOR_PC_RELATIVE
  639.  
  640. /* Specify the tree operation to be used to convert reals to integers.  */
  641. #define IMPLICIT_FIX_EXPR FIX_ROUND_EXPR
  642.  
  643. /* This is the kind of divide that is easiest to do in the general case.  */
  644. #define EASY_DIV_EXPR TRUNC_DIV_EXPR
  645.  
  646. /* Define this as 1 if `char' should by default be signed; else as 0.  */
  647. #define DEFAULT_SIGNED_CHAR 1
  648.  
  649. /* Max number of bytes we can move from memory to memory
  650.    in one reasonably fast instruction.  */
  651. #define MOVE_MAX 1
  652.  
  653. /* We can't use move by pieces due to l space problems. */
  654. #define MOVE_RATIO 0
  655. #define MOVE_RATIO_16 5
  656.  
  657. /* Nonzero if access to memory by bytes is slow and undesirable.  */
  658. #define SLOW_BYTE_ACCESS 1
  659.  
  660. /* Do not break .stabs pseudos into continuations.  */
  661. #define DBX_CONTIN_LENGTH 0
  662.  
  663. /* Value is 1 if truncating an integer of INPREC bits to OUTPREC bits
  664.    is done just by pretending it is already truncated.  */
  665. #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) ( LONG_TYPE_SIZE != INPREC )
  666.  
  667. /* We assume that the store-condition-codes instructions store 0 for false
  668.    and some other value for true.  This is the value stored for true.  */
  669.  
  670. #define STORE_FLAG_VALUE 1
  671.  
  672. /* Specify the machine mode that pointers have.
  673.    After generation of rtl, the compiler makes no further distinction
  674.    between pointers and any other objects of this machine mode.  */
  675. #define Pmode PSImode
  676.  
  677. /* A function address in a call instruction
  678.    is a byte address (for indexing purposes)
  679.    so give the MEM rtx a byte's mode.  */
  680. #define FUNCTION_MODE PSImode
  681.  
  682. /* Define this if addresses of constant functions
  683.    shouldn't be put through pseudo regs where they can be cse'd.
  684.    Desirable on machines where ordinary constants are expensive
  685.    but a CALL with constant address is cheap.  */
  686. #undef NO_FUNCTION_CSE
  687.  
  688. /* Compute the cost of computing a constant rtl expression RTX
  689.    whose rtx-code is CODE.  The body of this macro is a portion
  690.    of a switch statement.  If the code is computed here,
  691.    return it with a return statement.  Otherwise, break from the switch.  */
  692.  
  693. #define CONST_COSTS(RTX,CODE) \
  694.   case CONST_INT:                        \
  695.   case CONST:                            \
  696.   case LABEL_REF:                        \
  697.   case SYMBOL_REF:                        \
  698.   case CONST_DOUBLE:                        \
  699.     return 2;
  700.  
  701. /* Store in cc_status the expressions
  702.    that the condition codes will describe
  703.    after execution of an instruction whose pattern is EXP.
  704.    Do not alter them if the instruction would not alter the cc's.  */
  705.  
  706. #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc ( EXP, INSN )
  707.  
  708. enum mdep_cc_info { CC_UNKNOWN, CC_UNSIGNED, CC_SIGNED };
  709. #define CC_STATUS_MDEP enum mdep_cc_info
  710. #define CC_STATUS_MDEP_INIT CC_UNKNOWN
  711.  
  712.  
  713. /* Control the assembler format that we output.  */
  714.  
  715. /* Output at beginning of assembler file.  */
  716.  
  717. #define ASM_FILE_START(FILE) asm_file_start ( FILE ) 
  718.  
  719. #define ASM_FILE_END(FILE) asm_file_end ( FILE )
  720.  
  721. /* Output to assembler file text saying following lines
  722.    may contain character constants, extra white space, comments, etc.  */
  723. extern char* asm_app_toggle ();
  724. #define ASM_APP_ON asm_app_toggle ()
  725.  
  726. /* Output to assembler file text saying following lines
  727.    no longer contain unusual constructs.  */
  728.  
  729. #define MAX_TEXT_ALIGN 1
  730.  
  731. #define ASM_APP_OFF asm_app_toggle ()
  732.  
  733. #define SELECT_RTX_SECTION(MODE,X)\
  734. {\
  735.     data_section ( );\
  736. }
  737.  
  738. #define SELECT_SECTION(DECL)\
  739. {\
  740.     if ( FUNCTION_DECL == TREE_CODE ( DECL ))\
  741.     {\
  742.     text_section ( );\
  743.     }\
  744.     else\
  745.     {\
  746.     data_section ( );\
  747.     }\
  748. }
  749.  
  750.  
  751. /* Output before read-only data.  */
  752.  
  753. char *text_section_asm_op ( );
  754. #define TEXT_SECTION_ASM_OP text_section_asm_op ( )
  755.  
  756. /* Output before writable data.  */
  757.  
  758. char *data_section_asm_op ( );
  759. #define DATA_SECTION_ASM_OP data_section_asm_op ( )
  760.  
  761. /* How to refer to registers in assembler output.
  762.    This sequence is indexed by compiler's hard-register-number (see above).  */
  763.  
  764. #define REGISTER_NAMES                     \
  765. { "a", "b", "x0", "x1", "y0", "y1",            \
  766.   "r0", "r1", "r2", "r3" }
  767.  
  768. /* How to renumber registers for dbx and gdb.  */
  769.  
  770. #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
  771.  
  772. /* This is how to output the definition of a user-level label named NAME,
  773.    such as the label on a static function or variable NAME.  */
  774.  
  775. #define ASM_IDENTIFY_GCC(FILE) fprintf ( FILE, ";*** DSP561XX %s GNU %s\n", motorola_version_string, version_string );
  776.  
  777. #define ASM_OUTPUT_LABEL(FILE,NAME)    \
  778.   do { assemble_name (FILE, NAME); fputs ("\n", FILE); } while (0)
  779.  
  780. /* This is how to output a command to make the user-level label named NAME
  781.    defined for reference from other files.  */
  782.  
  783. #define ASM_GLOBALIZE_LABEL(FILE,NAME)    \
  784. ( fputs ("\tglobal\t", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE) )
  785.  
  786. /* This is how to output a reference to a user-level label named NAME.
  787.    `assemble_name' uses this.  */
  788.  
  789. #define ASM_OUTPUT_LABELREF(FILE,NAME)    \
  790.   fprintf (FILE, "F%s", NAME)
  791.  
  792. /* This is how to output an internal numbered label where
  793.    PREFIX is the class of label and NUM is the number within the class.  */
  794.  
  795. #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM)    \
  796.   fprintf (FILE, "%s%d\n", PREFIX, NUM)
  797.  
  798. /* This is how to store into the string LABEL
  799.    the symbol_ref name of an internal numbered label where
  800.    PREFIX is the class of label and NUM is the number within the class.
  801.    This is suitable for output with `assemble_name'.  */
  802.  
  803. #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM)    \
  804.   sprintf (LABEL, "*%s%d", PREFIX, NUM)
  805.  
  806. /* This is how to output an assembler line defining a `double' constant.  */
  807.  
  808. void dtok ( );
  809.  
  810. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)  \
  811.   (dtok( FILE, VALUE ))
  812.  
  813. /* This is how to output an assembler line defining a `float' constant.  */
  814.  
  815. #define ASM_OUTPUT_FLOAT(FILE,VALUE)  \
  816.   (dtok( FILE, VALUE ))
  817.  
  818. /* This is how to output an assembler line defining an `int' constant.  */
  819.  
  820. #define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE)                  \
  821.     (( 'l' == memory_model ) ?                          \
  822.      (( CONST_INT == GET_CODE( VALUE )) ?                  \
  823.       ( fprintf ( FILE, "\tdc\t$%08x\n",                  \
  824.          ( INTVAL ( VALUE )))) :                          \
  825.       ( fprintf ( FILE, "\tdc\t$%08x\n",                   \
  826.          ( CONST_DOUBLE_LOW ( VALUE ))))) :                      \
  827.      (( CONST_INT == GET_CODE( VALUE )) ?                  \
  828.       ( fprintf ( FILE, "\tdc\t$%04x\n\tdc\t$%04x\n",              \
  829.          ( INTVAL ( VALUE ) & 0xffff ),                        \
  830.          (( INTVAL ( VALUE ) >> 16 ) & 0xffff ))) :          \
  831.       ( fprintf ( FILE, "\tdc\t$%04x\n\tdc\t$%04x\n",                \
  832.          ( CONST_DOUBLE_LOW ( VALUE ) & 0xffff ),          \
  833.          (( CONST_DOUBLE_LOW ( VALUE ) >> 16 ) & 0xffff )))))
  834.  
  835. #define ASM_OUTPUT_INT(FILE,VALUE)  \
  836. ( fprintf (FILE, "\tdc "),            \
  837.   output_addr_const (FILE, (VALUE)),        \
  838.   fprintf (FILE, "\n"))
  839.  
  840. /* Likewise for `short' and `char' constants.  */
  841.  
  842. #define ASM_OUTPUT_SHORT(FILE,VALUE)  \
  843. ( fprintf (FILE, "\tdc "),            \
  844.   output_addr_const (FILE, (VALUE)),        \
  845.   fprintf (FILE, "\n"))
  846.  
  847. #define ASM_OUTPUT_CHAR(FILE,VALUE)  \
  848. ( fprintf (FILE, "\tdc "),            \
  849.   output_addr_const (FILE, (VALUE)),        \
  850.   fprintf (FILE, "\n"))
  851.  
  852. /* This is how to output an assembler line for a numeric constant byte.  */
  853.  
  854. #define ASM_OUTPUT_BYTE(FILE,VALUE)  \
  855.   fprintf (FILE, "\tdc $%x\n", (VALUE))
  856.  
  857. #define ASM_OUTPUT_ASCII(FILE, P, SIZE)  \
  858.   output_ascii (FILE, P, SIZE)
  859.  
  860. #define ASM_OUTPUT_CASE_LABEL(STREAM, PREFIX, NUM, TABLE )     \
  861.   ( fprintf (STREAM, "%s\n", DATA_SECTION_ASM_OP ),        \
  862.   ASM_OUTPUT_INTERNAL_LABEL(STREAM, PREFIX, NUM))
  863.  
  864. #define ASM_OUTPUT_CASE_END(STREAM, NUM, TABLE )         \
  865.   fprintf (STREAM, "%s\n", TEXT_SECTION_ASM_OP )        \
  866.  
  867. /* This is how to output an element of a case-vector that is relative.  */
  868.  
  869. #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL)  \
  870.   fprintf (FILE, "\tdc L%d-L%d\n", VALUE, REL)
  871.  
  872. /* This is how to output an element of a case-vector that is absolute.  */
  873.  
  874. #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
  875.   fprintf (FILE, "\tdc L%d\n", VALUE)
  876.  
  877. /* This is how to output an assembler line
  878.    that says to advance the location counter
  879.    to a multiple of 2**LOG bytes.  */
  880.  
  881. #define ASM_OUTPUT_ALIGN(FILE,LOG)
  882.  
  883. #define ASM_OUTPUT_SKIP(FILE,SIZE)  \
  884.   fprintf (FILE, "\tbsc\t%d\n", (SIZE))
  885.  
  886. /* This says how to output an assembler line
  887.    to define a global common symbol.  */
  888.  
  889. #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)          \
  890. (  ASM_GLOBALIZE_LABEL((FILE),(NAME)),                          \
  891.    assemble_name ((FILE), (NAME)),                              \
  892.    fprintf ((FILE), "\tbsc\t%d\n", (ROUNDED)))
  893.  
  894.  
  895. /* This says how to output an assembler line
  896.    to define a local common symbol.  */
  897.  
  898. #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED)  \
  899. ( assemble_name ((FILE), (NAME)),                \
  900.   fprintf ((FILE), "\tbsc\t%d\n", (ROUNDED)))
  901.  
  902. /* Store in OUTPUT a string (made with alloca) containing
  903.    an assembler-name for a local static variable named NAME.
  904.    LABELNO is an integer which is different for each call.  */
  905.  
  906. #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)    \
  907. ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),    \
  908.   sprintf ((OUTPUT), "___%s%d", (NAME), (LABELNO)))
  909.  
  910. /* Define the parentheses used to group arithmetic operations
  911.    in assembler code.  */
  912.  
  913. #define ASM_OPEN_PAREN "("
  914. #define ASM_CLOSE_PAREN ")"
  915.  
  916. /* Define results of standard character escape sequences.  */
  917. #define TARGET_BELL 007
  918. #define TARGET_BS 010
  919. #define TARGET_TAB 011
  920. #define TARGET_NEWLINE 012
  921. #define TARGET_VT 013
  922. #define TARGET_FF 014
  923. #define TARGET_CR 015
  924.  
  925. /* Print operand X (an rtx) in assembler syntax to file FILE.
  926.    CODE is a letter or dot (`z' in `%z0') or 0 if no letter was specified.
  927.    For `%' followed by punctuation, CODE is the punctuation and X is null.
  928. */
  929.  
  930. #define PRINT_OPERAND(FILE, X, CODE) print_operand ( FILE, X, CODE )
  931.  
  932. /* Print a memory address as an operand to reference that memory location.  */
  933.  
  934. #define PRINT_OPERAND_ADDRESS(FILE, ADDR) print_operand_address ( FILE, ADDR )
  935.  
  936. #define ASM_OUTPUT_REG_PUSH( FILE, REGNO )
  937. #define ASM_OUTPUT_REG_POP( FILE, REGNO )
  938.  
  939. #define ASM_OUTPUT_OPCODE( FILE, OPCODE ) 
  940.  
  941. /* the following definitions and declarations are used to efficiently
  942.    implement the use of either memory space. */
  943.  
  944. /* this structure is used within the code generator. it is initialized upon
  945.    first use. */
  946.  
  947. struct dsp_string
  948. {
  949.     int init;
  950.     char string[124];
  951. };
  952.  
  953. /* RETURN_DSP provides a mechanism for the code generator to use this facility
  954.    transparently. */
  955.  
  956. #define RETURN_DSP( str ) \
  957. { static struct dsp_string template = { 0, str }; \
  958.       return fix_mem_space ( & template ); }
  959.  
  960. /* global memory space indicator - either 'x' or 'y'. */
  961. extern char mem_space;
  962. extern char memory_model;
  963. /* tells sdbout which prolog/epilog pair is being used. */
  964. extern int logue_index;
  965.  
  966. extern char *fix_mem_space ( );
  967.  
  968. /* this data type is used to pass information about the function to the
  969.    optimizer and code generator, and pro/epilog generators. */
  970.  
  971. typedef enum 
  972. {
  973.     FUNC_NO_INFO = 0x0000,
  974.     FUNC_ISNT_LEAF = 0x0001,       /* this func makes at least one call */
  975.     FUNC_RETURNS_FLOAT = 0x0002,   /* a float/double value is returned */
  976.     FUNC_HAS_STACK_PARMS = 0x0004, /* this func has at least one stack parm */
  977.     FUNC_RETURNS_VOID =0x0008      /* this function is of type void. */
  978. } func_attributes;
  979.  
  980. /* a global var used for the aformentioned purpose. */
  981. extern func_attributes current_func_info;
  982.  
  983. /* these force a min number of operands allowed. */
  984. #define MIN_RECOG_OPERANDS 16
  985. #define MIN_DUP_OPERANDS 16
  986.  
  987. /* we undef abort so that we can print a proper warning message and not dump
  988.    core. (code in rtl.c) */
  989. #undef abort
  990.  
  991. /* this is a kludge. 
  992.    the dsp16 uses accumulators a and b in weird ways. b can hold either
  993.    a 32 bit or 16 bit value. if it holds a 32 bit value, there is no way
  994.    that ( SUBREG:SI ( REG:DI 1 ) 0 ) can be use as an arithmetic operand. 
  995.    the same rtl expression *can* be used as a move operand, namely b0.
  996.    eventually we might want to rethink the way that we're numbering registers
  997.    and possibly make accumulators look like a series of concatenated registers.
  998.    this, however, would require major rework of the md file, as each
  999.    SImode arith define_insn would need to be transformed into a define_expand
  1000.    and define_insn pair (for example, to reflect the clobber of a2 and a0
  1001.    in add x0,a). this change could severely inhibit optimization as well. 
  1002.  
  1003.    for now: we wll define INSN_MACHINE_INFO to differentiate between insns
  1004.    that can and cannot accept the above rtl expression type as an operand.
  1005.    */
  1006.  
  1007. typedef struct
  1008. {
  1009.     int can_accept_subreg_acc_p;
  1010. }
  1011. dsp16_insn_info;
  1012.  
  1013. #define INSN_MACHINE_INFO dsp16_insn_info
  1014.  
  1015. /* allow certain pragmas. */
  1016. int dsp_process_pragma_line ( );
  1017.  
  1018. #define TARGET_PROCESS_PRAGMA_LINE( f ) \
  1019. dsp_process_pragma_line ( f )
  1020.